package org.now.ypos.controller;

import org.now.ypos.core.BaseDto;

import java.time.LocalDateTime;

/**
 * Base Controller.
 *
 * @author wl
 * @since 2020.11.13
 */
public abstract class BaseController {

    /**
     * set common field for BaseDto create.
     *
     * @param baseDto baseDto
     */
    protected void setCommonFieldForCreate(final BaseDto baseDto) {
        baseDto.setCreateBy(1L);
        baseDto.setCreateTime(LocalDateTime.now());
    }

    /**
     * set common field for BaseDto update.
     *
     * @param baseDto baseDto
     */
    protected void setCommonFieldForUpdate(final BaseDto baseDto) {
        baseDto.setUpdateBy(1L);
        baseDto.setUpdateTime(LocalDateTime.now());
    }
}
